import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue'
import router from './router'
import './assets/css/global.css'
import './assets/font/iconfont.css'
import axios from 'axios'
import _ from 'lodash'
import TreeTable from 'vue-table-with-tree-grid'
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/';
axios.interceptors.request.use(config=>{
  config.headers.Authorization=sessionStorage.getItem('token')
  return config
})
Vue.filter('time',val=>{
  let time=new Date(val)
  let Y=time.getFullYear()
  let M=time.getMonth()+1
  let D=time.getDate()
  let H=time.getHours().toString().padStart(2, '0');
  let m=time.getMinutes().toString().padStart(2, '0');
  let s=time.getSeconds().toString().padStart(2, '0');
  return `${Y}-${M}-${D} ${H}:${m}:${s}`
})
Vue.prototype.$http=axios

Vue.component('tree', TreeTable)
Vue.use(ElementUI)
Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
